//
//  RootViewController.m
//  BlockAlertView
//
//  Created by cocoajin on 14-1-13.
//  Copyright (c) 2014年 www.zhgu.net. All rights reserved.
//

#import "RootViewController.h"
#import "BlockAlertView.h"
#import "BlockActionSheet.h"

@interface RootViewController ()

@end

@implementation RootViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    
    UIButton *aBtn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    [aBtn setTitle:@"showAlert" forState:UIControlStateNormal];
    aBtn.frame = CGRectMake(10, 10, 150, 30);
    [aBtn addTarget:self action:@selector(showBlockAlert) forControlEvents:UIControlEventTouchUpInside];
    
    [self.view addSubview:aBtn];
    
    UIButton *abtn2 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    [abtn2 setTitle:@"showAlert2" forState:UIControlStateNormal];
    abtn2.frame = CGRectMake(10, 50, 150, 30);
    [abtn2 addTarget:self action:@selector(showBlockAlert2) forControlEvents:UIControlEventTouchUpInside];
    
    [self.view addSubview:abtn2];
    
    UIButton *abtn3 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    [abtn3 setTitle:@"showAlert2" forState:UIControlStateNormal];
    abtn3.frame = CGRectMake(10, 90, 150, 30);
    [abtn3 addTarget:self action:@selector(showBlockAlert3) forControlEvents:UIControlEventTouchUpInside];
    
    [self.view addSubview:abtn3];
 
    
    UIButton *abtn4 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    [abtn4 setTitle:@"actionSheet" forState:UIControlStateNormal];
    abtn4.frame = CGRectMake(10, 130, 150, 30);
    [abtn4 addTarget:self action:@selector(actionSheet) forControlEvents:UIControlEventTouchUpInside];
    
    [self.view addSubview:abtn4];
    
    
    [BlockAlertView showAlert:@"title" message:@"message" cancel:@"确定" comfirm:nil clickBlock:nil];
    
}

- (void)showBlockAlert
{
    [BlockAlertView showAlert:@"test" message:@"ssss" cancel:@"no" comfirm:@"yes" clickBlock:^(UIAlertView *alertView, int clickIndex) {
        NSLog(@"222%@ %d",alertView,clickIndex);
    }];
}

- (void)showBlockAlert2
{
    [BlockAlertView showAlert:@"test" message:@"ssss" cancel:@"no" comfirm:@"yes" clickBlock:^(UIAlertView *alertView, int clickIndex) {
        NSLog(@"222%@ %d",alertView,clickIndex);
    }];
}

- (void)showBlockAlert3
{
    NSArray *btnArrays = [NSArray arrayWithObjects:@"10分",@"8分",@"6分", nil];
    [BlockAlertView showAlert:@"title" message:@"message" cancel:@"取消" otherBtn:btnArrays clickBlock:^(UIAlertView *alertView, int clickIndex) {
        NSLog(@"333 %d",clickIndex);
    }];
}

- (void)actionSheet
{
    NSArray *btnArrays = [NSArray arrayWithObjects:@"1",@"2",@"3",@"4", nil];
    [BlockActionSheet showActionSheet:@"title" cancel:@"cancel" destruct:@"desturct" otherBtns:btnArrays sheetStyle:UIActionSheetStyleBlackOpaque clickBlock:^(UIActionSheet *actionSheet, int clickIndex) {
        NSLog(@"actionsheet %d",clickIndex);
    }];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
